package com.ysd.lis.controller;

import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.TDeptGroup;
import com.ysd.lis.request.OrgDepartmentParam;
import com.ysd.lis.service.TDeptGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "分组管理")
@RestController
@RequestMapping("/api/sys")
public class TDeptGroupController extends BaseController {
    @Autowired
    TDeptGroupService tDeptGroupService;

    @ApiOperation("新增分组")
    @PostMapping("/addDeptGroup")
    public Result addDeptGroup(@RequestBody TDeptGroup tDeptGroup) {
        return tDeptGroupService.addDeptGroup(tDeptGroup);
    }
    @ApiOperation("根据部门获取分组")
    @GetMapping("/findDeptGroupListByDeptId")
    public Result findDeptGroupListByDeptId(String deptId,String status){
        return tDeptGroupService.findDeptGroupListByDeptId(deptId,status);
    }
    @ApiOperation("修改分组")
    @PutMapping("/editDeptGroup")
    public Result editDeptGroup(@RequestBody TDeptGroup tDeptGroup) {
        return tDeptGroupService.editDeptGroup(tDeptGroup);
    }
    //deleteDeptGroup
    @ApiOperation("删除申请单样品信息")
    @DeleteMapping("/deleteDeptGroup/{id}")
    public Result deleteDeptGroup(@PathVariable("id")String id){
        return tDeptGroupService.deleteDeptGroup(id);
    }

    //getDeptGroupListByOrgId
    @ApiOperation("根据机构获取部门")
    @GetMapping("/getDeptGroupListByOrgId")
    public Result getDeptGroupListByOrgId(OrgDepartmentParam orgDepartmentParam){
        return  tDeptGroupService.getDeptGroupListByOrgId(orgDepartmentParam);
    }
}
